<template>
	<div>
		<div class="subpic">
			<img src="../../../../src/assets/img/questionsub.png" alt="">
		</div>
		<div class="subcon">
			<div class="sbutitle">意见及建议</div>
			<textarea placeholder="请尽量描述您所遇到的问题，有助于我们尽快回复" v-model="detail"></textarea>
			<div class="sbutitle">联系方式</div>
			<input type="text" placeholder="请填写您的电话或QQ邮箱" v-model="phone">
		</div>
		<div class="subbottom">
			<div class="subphone">您还可拨打:<a href="tel:15639255665"> 15639255665（8:30-18:00)</a>进行反馈。 </div>
			<div class="submit" @click="submit">提交</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				detail:'',
				phone:'',
				url:this.$store.state.url,//接收路由过来的图片地址前缀
			};
		},
		methods:{
			submit(){
				var that = this;
				if(that.detail==''){
					layer.open({
						content: '请描述您所遇到的问题',
						skin: 'msg',
						time: 2 //1秒后自动关闭
					});
				}else if(that.phone==''){
					layer.open({
						content: '请填写您的电话或QQ邮箱',
						skin: 'msg',
						time: 2 //1秒后自动关闭
					});
				}else if((!(/^1\d{10}$/.test(that.phone)))&&(!(/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g).test(that.phone))){
					layer.open({
						content: '请填写正确的联系方式',
						skin: 'msg',
						time: 2 //1秒后自动关闭
					});
				}else{
					// console.log(8989)
					that.axios({
						method:'POST',
						url:that.url+'Find/feedback',
						data:{
							content:that.detail,
							information:that.phone
						},
					}).then((res)=>{
						if(res.data.errcode==0||res.data.errcode=='0'){
							layer.open({
								content: '提交成功',
								skin: 'msg',
								time: 2 //1秒后自动关闭
							});
							setTimeout(function(){
								that.$router.go(-1)
							},1000)
							
						}else{
							layer.open({
								content: res.data.msg,
								skin: 'msg',
								time: 2 //1秒后自动关闭
							});
						}
					})
				}
			}
		},
		mounted(){
			this.sdk.getJSSDK('','',this.$store.state.url);	
		}
	}
</script>

<style scoped="scoped">
.subpic{
	width: 7.5rem;
	height: 2.73rem;
}
.subpic img{
	width: 100%;
	height: 100%;
}
.subcon{
	width: 6.9rem;
	margin: auto;
}
.sbutitle{
	margin: .46rem 0 .25rem;
	font-size: .3rem;
}
textarea{
	display: block;
	width: 6.9rem;
	height: 2.95rem;
	overflow-y: scroll;
	padding: .3rem;
	background: #F7F7F7;
	border-radius: .1rem;
	border: none;
	outline: none;
	font-size: .26rem;
	color: #333;
}
input{
	width: 6.9rem;
	display: block;
	border: none;
	outline: none;
	height: .82rem;
	line-height: .82rem;
	font-size: .26rem;
	padding-left: .3rem;
	color: #333;
	background: #F7F7F7;
	border-radius: .1rem;
}
.subbottom{
	width: 7.5rem;
	position: fixed;
	bottom: 0;
}
.subphone{
	text-align: center;
	color: #999999;
	font-size: .24rem;
	text-align: center;
	padding-bottom: .47rem;
}
.subphone a{
	color: #0287FF;
}
.submit{
	line-height: .88rem;
	text-align: center;
	color: #fff;
	background: #0287FF;
	font-size: .36rem;
	font-weight: 600;
}
</style>
